# Copyright (c) 2009 Daropia Project (www.daropia.org)
#
# This file is part of Daropia and is available under the terms
# of the GNU General Public Licence version 2.0 or later.


# Completes the forum basic tables

Class.new(Sequel::Migration) do

	def up
	    alter_table :forums do
	        add_column :topic_count, :integer, :default => 0
	    end
	    
		alter_table :topics do
			add_column :locked, :boolean, :default => false
			add_column :permanent, :boolean, :default => false
			add_column :post_count, :integer, :default => 0
			rename_column :title, :name
		end
		
		alter_table :posts do
		    rename_column :text, :content
		end
	end

	def down
	    alter_table :forums do
	        drop_column :topic_count
	    end
	    
		alter_table :topics do
			drop_column :locked
			drop_column :permanent
			drop_column :post_count
			rename_column :name, :title
		end
		
		alter_table :posts do
		    rename_column :content, :text
		end
	end

end
